function e(e, t, a) {
    return t in e ? Object.defineProperty(e, t, {
        value: a,
        enumerable: !0,
        configurable: !0,
        writable: !0
    }) : e[t] = a, e;
}

var t, a = getApp(), r = (require("../../data/driverMockData.js"), require("../../utils/function.js")), n = (require("../../data/citys.js"), 
require("../../api.js")), s = require("../../wxParse/wxParse.js");

Page({
    data: (t = {
        showToast: !1,
        test: a.test,
        Img: r.driverImg,
        addressName: null,
        avatar: "../../../images/driver/icon-02.png",
        activityList: [],
        currentTime: null,
        income: 0,
        reminder: "今日周一，无限号通知，多云25-30，事宜短袖。每日6点会更新数据信息。新的一天，不要忘记微笑哦。",
        name: "",
        orderCount: 0
    }, e(t, "income", 0), e(t, "evaluate", []), e(t, "myTask", []), e(t, "serverPhone", ""), 
    e(t, "left", 700), e(t, "is_false", !1), e(t, "remind", ""), e(t, "way", 0), e(t, "authorization", 1), 
    e(t, "work_status", ""), e(t, "todayincome", "0.00"), t),
    toDetail: function(e) {
        var e = e.currentTarget.dataset.url;
        wx.navigateTo({
            url: e
        });
    },
    showToast: function(e) {
        var t = e.currentTarget.dataset.url;
        this.setData({
            showToast: t || e.detail.showToast
        });
    },
    hideToast: function(e) {
        this.setData({
            showToast: e.detail.showToast
        });
    },
    get_wxGZH: function() {
        var e = this;
        wx.getStorageSync("access_token") && 1 != wx.getStorageSync("is_as") && a.request({
            url: n.user.binding,
            method: "post",
            data: {},
            success: function(t) {
                1 != t.data.authorization && e.setData({
                    authorization: t.data.authorization
                });
            }
        });
    },
    navTo: function(e) {
        a.navTo(e.currentTarget.dataset.url);
    },
    onLoad: function(e) {
        this.get_wxGZH(), setInterval(this.timeTask, 1e3), e.uid && a.shareCouponsMessage(e.uid);
    },
    timeTask: function() {
        var e = new Date();
        this.setData({
            currentTime: {
                h: e.getHours(),
                m: e.getMinutes()
            }
        });
    },
    onShow: function() {
        var e = this;
        r.getLatLntHandler(function(t) {
            e.setData({
                addressName: t.address
            });
        }), this.setDataHandler(), this.getDataHnadler(), a.request({
            url: n.driver.getset,
            method: "post",
            data: {},
            success: function(t) {
                e.setData({
                    work_status: t.data.work_status
                });
            }
        });
    },
    gotoTodayInforamtion: function() {
        wx.navigateTo({
            url: "/pages/driver/todayOrder/index"
        });
    },
    getDataHnadler: function() {
        var e = this, t = this;
        wx.getStorageSync('narnum')
        a.request({
            url: n.driver.index,
            method: "post",
            data: {
                
            },
            success: function(a) {
                0 == a.data.is_complete && wx.redirectTo({
                    url: "../../../../driver/personalInformation/personalInformation"
                });
                for (var r = a.data.announcement, n = 0; n < a.data.announcement.length; n++) s.wxParse("article", "html", r[n].content, t, 5);
                e.setData({
                    orderCount: a.data.Todayorder,
                    income: a.data.income,
                    todayincome: a.data.todayincome,
                    activityList: a.data.announcement,
                    is_false: a.data.reward,
                    way: a.data.way,
                    like: a.data.like
                }), wx.setStorageSync("customer", a.data.customer), wx.setStorageSync("like", a.data.like);
            }
        });
    },
    setDataHandler: function() {
        var e = "" !== wx.getStorageSync("userMessage") ? wx.getStorageSync("userMessage").avatar : "../../../images/icon/icon-02.png", t = "" !== wx.getStorageSync("userMessage") ? wx.getStorageSync("userMessage").username : "";
        this.setData({
            avatar: e,
            evaluate: wx.getStorageSync("evaluate").length,
            name: t
        });
    },
    intoPageHandler: function(e) {
        r.intoPageHandler(e.currentTarget.dataset.skip);
    },
    callPhoneHandler: function() {
        r.callPhoneHandler(wx.getStorageSync("serverphone"));
    },
    intoPersonCenterHandler: function() {
        r.intoPageHandler("../driver/personalCenter/personalCenter");
    },
    getOrderHandler: function(e) {
        var t = this;
        if (2 == e.currentTarget.dataset.way) wx.showToast({
            title: "听单方式为指派接单",
            icon: "none",
            duration: 1e3
        }); else if (1 == t.data.work_status) wx.showToast({
            title: "目前是下班状态，不能接单",
            icon: "none",
            duration: 1e3
        }); else {
            wx.getStorageSync("setup");
            wx.navigateTo({
                url: "../driverOrder/getOrder/getOrder?like=" + t.data.like
            });
        }
    },
  
  
  







});